home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 108 / MacAddict108.iso / Software / Development / REALbasic 5.5.5.dmg / REALbasic 5.5.5 Mac OS X / Read Me / Game_Input_ReadMe.txt < prev    next >
Encoding:
Text File  |  2005-03-18  |  3.3 KB  |  104 lines

  1. Game Input Read Me.txt
  2. ======================
  3.  
  4. REALbasic 5.5 introduces some new classes that allow you to access 
  5. game input devices, such as joysticks, game pads, and the keyboard, 
  6. on certain computer systems.
  7.  
  8. System Requirements
  9. -------------------
  10. Windows: DirectX 8 must be installed in order to access any input 
  11. devices (including the keyboard).
  12.  
  13. MacOS 8-9: only the keyboard and main mouse button are available as 
  14. input devices.
  15.  
  16. Mac OS X: the keyboard and mouse button are always available, as on 
  17. MacOS 8-9.  In addition, as long as you have the file called 
  18. "HID.Bundle" in the same folder as your application, you'll be able 
  19. to access other game input devices such as joysticks.  (We may allow 
  20. this file to be found in other locations in the future.)
  21.  
  22. Usage
  23. -----
  24. To use the new functionality, make a single instance of the 
  25. GameInputManager class.  You can then ask it for a list of available 
  26. devices, and get a list of elements (such as buttons or joystick 
  27. axes) from each device.  In addition, you can ask the 
  28. GameInputManager to wait for the user to wiggle or press any element, 
  29. and return the element so indicated.  This can be used to allow 
  30. configuration of your game controls.
  31.  
  32.  
  33. GameInputManager class
  34. ----------------------
  35. Methods:
  36.   DeviceCount as Integer -- Counts the number of input devices attached
  37.  
  38.   Device(index as Integer) as GameInputDevice -- Gets the device at that index
  39.  
  40.   WaitForElement(timeout as Single) as GameInputElement -- Waits for 
  41. an element to change on any input device.  The timeout is specified 
  42. in seconds.
  43.  
  44.  
  45. GameInputDevice class
  46. ---------------------
  47. Properties:
  48.   Index as Integer -- The index of this device in the manager
  49.  
  50.   Name as String -- The human-readable, unique name for the device
  51.  
  52.   Connected as Boolean -- Whether the device is currently considered connected
  53.  
  54.   ElementCount as Integer -- The number of elements the device has
  55.  
  56. Methods:
  57.   Element(index as Integer) as GameInputElement -- gets the element 
  58. indexed from the device
  59.  
  60.  
  61. GameInputElement class
  62. ----------------------
  63. Properties:
  64.   Name as String -- the name of the element
  65.  
  66.   Device as GameInputDevice -- the device that owns this element
  67.  
  68.   Value as Integer -- the current value of this element
  69.  
  70.  
  71. Examples
  72. --------
  73. (mManager and mFireButton are both global properties of type 
  74. GameInputManager and GameInputElement, respectively).
  75.  
  76. ----------
  77. ' Make sure we have an input manager
  78. if mManager = nil then
  79.    mManager = new GameInputManager
  80. end
  81.  
  82. ' Let's find out what element the user would like to use
  83. ' as their fire key.
  84. mFireButton = mManager.WaitForElement( 3 )  ' wait for 3 seconds, then give up
  85.  
  86. if mFireButton <> nil then
  87.    MsgBox "You are now using " + mFireButton.Name + " as your fire key"
  88. end
  89. -----------
  90. ' Let's check to see if the user fired, and if they did, we
  91. ' will do something really cool!
  92. if mFireButton <> nil and mFireButton.Value <> 0 then
  93.    DoSomethingReallyCool()
  94. end
  95. ------------
  96.  
  97. The first example shows how you can allow the user to configure what 
  98. devices and actions on those devices will correspond to your game's 
  99. actions.  The second example shows how you can use an element to 
  100. determine whether it is time to do its corresponding game action. 
  101. Note that in the second example, we are polling for the current state 
  102. of that element (instead of getting an old value out of it).
  103.  
  104.